package cz.anime.ppro.logic;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import cz.anime.ppro.model.Fragment;
import cz.anime.ppro.model.Webuser;
import cz.anime.ppro.repositories.FragmentRepository;
import cz.anime.ppro.repositories.UserRepository;

@Component
public class MainPageComponentImpl implements MainPageComponent {

	@Autowired
	private FragmentRepository fragmentRepository;
	
	@Autowired
	private UserRepository userRepository;

	@Override
	public Webuser getUser(int userId) {
		return userRepository.findOne(userId);
	}

	@Override
	public List<Fragment> getFragments() {
		return fragmentRepository.findAll();
	}
}
